﻿txjs.va.rules.test = function(value, element, param)
{
  
    return /^\d{6}$/.test(value);
};

//表格对象
var test = new table("table1");
test.setOption({"td1":"textarea"});

		//添加验证规则
	test.addvaRule({td0:{email:"请输入email"},td1:{test:"输入正确留个书"}});

//向下移动行
addEvent(id("movebottom"),"click",function(e){
	test.moveRow(e);
});

//向上移动行
addEvent(id("movetop"),"click",function(e){
	test.moveRow(e,1);
});

//删除一行
addEvent(id("delRow"),"click",function(e){
	test.delRow();
});

//在当前行上新建一行
addEvent(id("newTopRow"),"click",function(e){
	test.newTopRow();
});

//在当前行下新建一行
addEvent(id("newBottomRow"),"click",function(e){
	test.newBottomRow();
});

//编辑开关
addEvent(id("edited"),"click",function(e){
	(this.innerHTML == "可编辑") ?  this.innerHTML = "取消编辑" : this.innerHTML = "可编辑";
	//edited();
	test.enableedit();
});

addEvent(id("vatest"),"click",function(){
	var t = test.vaTableData();
	alert(t);
});


//备注
var commentTable = new table("comment");
commentTable.setOption({"td1":"textarea"});
commentTable.enableedit();
commentTable.readOnly([0,"*"]);






